prefs = {
	prefHash: {},
	deserializePrefsFromFileSystem: function() {
		var fname = prefs.getPrefsFileLocation();
		if (DWfile.exists(fname)) {
			var rawFileData = DWfile.read(fname);
			var itemList = rawFileData.split("----DUSPLIT----");
			for (var i = 0; i < itemList.length; i++) {
				var iObj = itemList[i].split("**ITEMSPLIT**");
				prefs.prefHash[iObj[0]] = iObj[1];
			}
		}		
	},
	serializeAndWriteSetsToFileSystem: function() {
		var setText = "";
		var i = 0;
		for (var item in prefs.prefHash) {
			if (i > 0)
				setText += "----DUSPLIT----";
			setText += item+"**ITEMSPLIT**"+prefs.prefHash[item]+"**ITEMSPLIT**";
			i = i + 1;
		}
		// delete it
		if (DWfile.exists(prefs.getPrefsFileLocation())) {
			DWfile.remove(prefs.getPrefsFileLocation());
		}
		
		// now write it fresh
		DWfile.write(prefs.getPrefsFileLocation(), setText);
	},	
	getPref: function(prefName) {
		return prefs.prefHash[prefName.toLowerCase()];
	},
	setPref: function(prefName, prefValue) {
		prefs.prefHash[prefName.toLowerCase()] = prefValue;
		prefs.serializeAndWriteSetsToFileSystem();
	},	
	init: function() {
		prefs.deserializePrefsFromFileSystem();
	},
	getPrefsFileLocation: function() {
		return dw.getConfigurationPath() + "/Shared/du/config/duprefs.dat"; 
	}
}